using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace usm.SolDev.DataBase.DataObjects
{
    public enum CodeElementType
    {
        unknown,
        program,
        process,
        monitor,
        store,
        facility,
        table,
        integer,
        real,
    }

    public class CodeElement
    {
        #region Private data
        private string name;
        private CodeElementType type;
        private int sourceLine;
        private string lineText;
        private int index;
        private List<CodeElementType> elements;
        private Color elementColor;
        #endregion

        #region Constructors
        /// <summary>
        ///     Default constructor
        /// </summary>
        public CodeElement() { }
        #endregion

        #region Public properties
        /// <summary>
        ///     Hold the element name (title)
        /// </summary>
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        /// <summary>
        ///     The element type (see CodeElementType enum for available types)
        /// </summary>
        public CodeElementType Type
        {
            get { return type; }
            set { type = value; }
        }

        /// <summary>
        ///     The line number in the source file where element has been 
        /// detected.
        /// </summary>
        public int SourceLine
        {
            get { return sourceLine; }
            set { sourceLine = value; }
        }

        /// <summary>
        ///     The full text of the line where element has been detected
        /// </summary>
        public string LineText
        {
            get { return lineText; }
            set { lineText = value; }
        }

        /// <summary>
        ///     The child elements which are contained inside of this element
        /// (for variables which are parts of some processes)
        /// </summary>
        public List<CodeElementType> Elements
        {
            get { return elements; }
            set { elements = value; }
        }

        /// <summary>
        ///     The index of the matched result. This member is used lately
        /// to determine the elements parents (position in source line)
        /// </summary>
        public int Index
        {
            get { return index; }
            set { index = value; }
        }
        
        /// <summary>
        ///     The element color (in tree list)
        /// </summary>
        public Color ElementColor 
        {
            get { return elementColor; }
            set { elementColor = value; }
        }
        #endregion
    }

}
